package com.pesking.core.sqlparser.processor;

import java.util.Arrays;
import java.util.List;

import com.pesking.core.parameter.Parameter;
import com.pesking.core.sqlparser.parameter.SqlParameter;
import com.pesking.core.sqlparser.parameter.SqlParameterProcessor;

public class DeleteFlagSqlParameterHandler extends SqlParameterProcessor {

	/**
	 * 处理参数
	 * @param sbSQL
	 * @param sqlParameter
	 * @param parameter
	 * @param ps
	 * @param index
	 */
	public void handle(final StringBuilder sbSQL
						,final Parameter requestParameter
						,final List<SqlParameter> processors
						,final SqlParameter sqlParameter) {
		String name = sqlParameter.getName();
		String value = requestParameter.getParameter(name);
		if ("1".equals(value)) {
			value = "1";
		}
		else {
			value = "0";
		}
		sbSQL.append(value);
	}

	@Override
	public List<String> getSqlParameterType() {
		return Arrays.asList(new String []{"DELETE_FLAG"});
	}

}
